package com.aier.school.action;

import java.io.File;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import com.aier.school.service.ISchoolService;

@Scope("prototype")
@Component("schoolQCAccountAction")
public class SchoolQCAccountAction extends SchoolBaseAction {

    /**
     * 学校管理-快速创建教师和学生家长
     */
    private static final long serialVersionUID = 1L;

    @Resource(name = "schoolService")
    private ISchoolService schoolService;    
    
    private int s;                //成功:1 ,失败:0
    private String error_info;    //错误提示信息
    
    private Integer sid;        //学校id
    private Long tid;            //学校id
    private File file;        //模板文件
    private String fileContentType;


    
    @Override
    public String execute(){
        return SUCCESS;
    }    
    
    /**
     * 上传模板信息(解析生成) 1:成功 0:失败
     */
    public String uploadExcelModule() {
        try {
            if (file == null) {
                s = 0;
                error_info = "请选择一个导入模板";
                return SUCCESS;
            }
            s = schoolService.insertQuickSchool(file, fileContentType,sid);
        } catch (Exception e) {
            s = 0;
            error_info = e.getLocalizedMessage();
        }
        return SUCCESS;
    }

    public Integer getSid() {
        return sid;
    }

    public void setSid(Integer sid) {
        this.sid = sid;
    }

    public Long getTid() {
        return tid;
    }

    public void setTid(Long tid) {
        this.tid = tid;
    }


    public void setFileContentType(String fileContentType) {
        this.fileContentType = fileContentType;
    }

    public int getS() {
        return s;
    }

    public String getError_info() {
        return error_info;
    }

    public void setSchoolService(ISchoolService schoolService) {
        this.schoolService = schoolService;
    }

    public void setFile(File file) {
        this.file = file;
    }


    
}
